package com.superatom.designpattern.singleton.eagersingleton;

import java.util.concurrent.CountDownLatch;

public class EagerSingletonMain {

    public static void main(String[] args) {
        // int count = 5;

        CountDownLatch latch = new CountDownLatch(1);

        for (int i = 0; i < 50; i++){
            new Thread(){
                @Override
                public void run() {
                    try {
                        latch.await();
                    } catch (InterruptedException e) {
                        e.printStackTrace();
                    }
                    EagerSingleton.getInstance();
                }
            }.start();
        }

        latch.countDown();
    }
}
